import { DefaultFooter, MenuDataItem, getMenuData, getPageTitle } from '@ant-design/pro-layout';
import { HelmetProvider } from 'react-helmet-async';
import { useIntl, ConnectProps, connect } from 'umi';
import React from 'react';
import { ConnectState } from '@/models/connect';
import styles from './UserLayout.less';
import { GithubOutlined } from '@ant-design/icons';

export interface UserLayoutProps extends Partial<ConnectProps> {
  breadcrumbNameMap: {
    [path: string]: MenuDataItem;
  };
}

const defaultFooterDom = (
  <DefaultFooter
    copyright={`冀ICP备2021010083号`}
    links={[
      {
        key: 'Ant Design Pro',
        title: '数字蜂巢（DigiHive）',
        href: 'https://pro.ant.design',
        blankTarget: true,
      }
    ]}
  />
);

const UserLayout: React.FC<UserLayoutProps> = (props) => {
  const {
    route = {
      routes: [],
    },
  } = props;
  const { routes = [] } = route;
  const {
    children,
    location = {
      pathname: '',
    },
  } = props;
  const { formatMessage } = useIntl();
  const { breadcrumb } = getMenuData(routes);
  const title = getPageTitle({
    pathname: location.pathname,
    formatMessage,
    breadcrumb,
    ...props,
  });
  return (
    <HelmetProvider>
      <div className={styles.container}>
        <div className={styles.contbox}>
          <div className={styles.left_pg}>

          </div>
          <div className={styles.right_pg}>
            <div className={styles.lang}>
              
            </div>
            <div className={styles.content}>
              <div className={styles.top}>
                <div className={styles.header}>
                  <span className={styles.title}>欢迎登陆</span>
                </div>
              </div>
              {children}
            </div>
          </div>
        </div>
        {defaultFooterDom}
      </div>
      
    </HelmetProvider>
  );
}; 

export default connect(({ settings }: ConnectState) => ({ ...settings }))(UserLayout);
